package threads;

import jsonobj.ClusterStatusInfo;
import utils.Utils;



public class MonitorThread extends Thread{
	public static volatile boolean run = true;
	public void run()
	{
		while (run) {
			try {
				ClusterStatusInfo i = new ClusterStatusInfo();
				if(i.freenodes == 0 && i.freeprocs == 0 && i.activejobs == 0)
				{
					//Utils.out("FAILED here");
					Thread.sleep(60 * 1000);
					continue;
				}
				Utils.ws.send(new ClusterStatusInfo());
				Thread.sleep(60 * 1000);
			} catch (Exception e) {
				return;
			}
		}
	}
}
